import os
import shutil
# /home/mikoptik/yolov7_test/yolo_v7/ringAndringcircle/
source_folder = '/home/mikoptik/yolov7_test/yolo_v7/match_circle/1/res'  # 源文件夹路径
destination_folder = '/home/mikoptik/yolov7_test/yolo_v7/ringAndringcircle/res'  # 目标文件夹路径
# /home/mikoptik/yolov7_test/yolo_v7/circle0801/
# 确保目标文件夹存在
if not os.path.exists(destination_folder):
    os.makedirs(destination_folder)

# 遍历源文件夹中的所有文件
for filename in os.listdir(source_folder):
    if filename.startswith('ring') or filename.startswith('ring+'):
        # 构建源文件路径和目标文件路径
        source_path = os.path.join(source_folder, filename)
        destination_path = os.path.join(destination_folder, filename)

        # 复制文件到目标文件夹中
        shutil.copy2(source_path, destination_path)

print('已成功复制到新的文件夹！')
